﻿@using RooHui.Infrastructure.Entities
@using RooHui.Infrastructure.Entities.Enum
@{
    ViewBag.Title = "Activity";
    Layout = "~/Views/Shared/_Member.cshtml";
}
@section head{
    <link type="text/css" href="/content/plugins/jquery-ui-1.10.0.custom/jquery-ui-1.10.0.custom.css"
        rel="stylesheet" />
    <!--[if lt IE 9]>
	    <link rel="stylesheet" type="text/css" href="/content/plugins/jquery-ui-1.10.0.custom/jquery.ui.1.10.0.ie.css"/>
    <![endif]-->
}
<div class="container" style="margin-top: 20px;">
    <div class="headline">
        <h2>
            交易明细</h2>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <form action="/member/activity" method="get" class="form-inline">
            <input type="text" id="txtstart" value="@Request.QueryString["start"]" name="start" class="input-small input-large" placeholder="起始时间" />
            -
            <input type="text" id="txtend" value="@Request.QueryString["end"]" name="end" class="input-small input-large" placeholder="结束时间" />
            <button type="submit" class="btn">
                筛选</button>
            </form>
        </div>
    </div>
    <div class="row-fluid" style="min-height: 400px;">
        <table class="table">
            <thead>
                <tr>
                    <th width="20%">
                        交易类型
                    </th>
                    <th width="15%">
                        资金
                    </th>
                    <th width="20%">
                        交易时间
                    </th>
                    <th>
                        描述
                    </th>
                </tr>
            </thead>
            <tbody>
                @{
                    ItemListBox<RooHui.Infrastructure.Entities.Entity.AmountOperation> list =
                        ViewBag.Operations;
                    if (list != null && list.Data != null && list.Data.Any())
                    {
                        foreach (var item in list.Data)
                        {
                    <tr>
                        <td>
                            @item.OperationType.Mapping()
                        </td>
                        <td>
                            @Html.Raw(RooHui.Portal.WebLogic.Style.MakeAmountOperationStyle(item.Amount, item.OperationType))
                        </td>
                        <td class="hidden-sm">
                            @item.CreateTime.ToString("yyyy.MM.dd HH:mm")
                        </td>
                        <td>
                            @item.Summary 
                            @if(!String.IsNullOrEmpty(item.RefId))
                            {
                                <a href="/project/detail?id=@item.RefId"  style="color:#3498db;" target="_blank">查看项目</a>
                            }
                        </td>
                    </tr>
                        }
                    }
                }
            </tbody>
        </table>
    </div>
    @Html.Raw(list.PageItemSegment)
</div>
@section scripts{
    <script type="text/javascript" src="/content/plugins/jquery-ui-1.10.0.custom/jquery-ui-1.10.0.custom.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#labActivity').addClass('active');
            $('#txtstart').datepicker({
                //defaultDate: +1,
                dateFormat: 'yy/mm/dd',
                firstDay: 1,
                maxDate: new Date(),
                numberOfMonths: 2,
                inline: true
            });
            $('#txtend').click(function () {
                var minDate = null;
                if ($('#txtstart').val() != '') {
                    minDate = new Date($('#txtstart').val());
                }
                if (!$(this).datepicker('option', 'numberOfMonths')) {
                    $(this).datepicker({
                        //defaultDate: +1,
                        dateFormat: 'yy/mm/dd',
                        firstDay: 1,
                        minDate: minDate ? '' : minDate,
                        maxDate: '+7m',
                        numberOfMonths: 2,
                        maxDate: new Date(),
                        inline: true
                    }).focus();
                } else {
                    $(this).datepicker('option', 'minDate', new Date($('#txtstart').val())).focus();
                }
            });
        });
    </script>
}
